package com.elitel.frame.core.service.impl;

import org.springframework.stereotype.Service;

import com.elitel.frame.core.service.FileService;

@Service
public class FileServiceImpl extends BaseServiceImpl implements FileService {

/*    @Override
    public File saveFile(MultipartFile file, String savePath, String saveName)
            throws IOException {
        File pathFile = new File(savePath);
        File saveFile = new File(pathFile, saveName);
        if (!pathFile.exists()) {
            pathFile.mkdirs();
        }
        FileCopyUtils.copy(file.getBytes(), saveFile);
        return saveFile;
    }

    @Override
    public Collection<?> excelImport(MultipartFile sourceFile,
            Class<?> pojoClass, String savePath, String saveName,
            Boolean saveToServer) throws IOException {
        File saveFile = saveFile(sourceFile, savePath, saveName);
        Collection<?> list = null;
        if (saveFile.exists()) {
            ImportParams params = new ImportParams();
            params.setTitleRows(0);
            params.setHeadRows(1);
            params.setNeedSave(false);
            list = ExcelImportUtil.importExcel(saveFile, pojoClass, params);
        }
        if (!saveToServer) {
            saveFile.delete();
        }
        return list;
    }*/
}
